<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="icon" type="image/x-icon" href="favicon.ico" />
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>chigraph: lib/core/include/chi/FunctionCompiler.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="chigraphDoxygenIcon.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">chigraph
   &#160;<span id="projectnumber">master</span>
   </div>
   <div id="projectbrief">Systems programming language written for beginners in LLVM</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('FunctionCompiler_8hpp_source.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">FunctionCompiler.hpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="FunctionCompiler_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div><div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="preprocessor">#pragma once</span></div><div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;</div><div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="preprocessor">#ifndef CHI_FUNCTION_COMPILER_HPP</span></div><div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="preprocessor">#define CHI_FUNCTION_COMPILER_HPP</span></div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;</div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="core_2include_2chi_2Fwd_8hpp.html">chi/Fwd.hpp</a>&quot;</span></div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="LLVMVersion_8hpp.html">chi/LLVMVersion.hpp</a>&quot;</span></div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="NodeCompiler_8hpp.html">chi/NodeCompiler.hpp</a>&quot;</span></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;</div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#include &lt;llvm/IR/DebugInfo.h&gt;</span></div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;</div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="preprocessor">#include &lt;memory&gt;</span></div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="preprocessor">#include &lt;unordered_map&gt;</span></div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;</div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="preprocessor">#include &lt;boost/bimap.hpp&gt;</span></div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="preprocessor">#include &lt;boost/utility/string_view.hpp&gt;</span></div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;</div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacechi.html">chi</a> {</div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;</div><div class="line"><a name="l00024"></a><span class="lineno"><a class="line" href="structchi_1_1FunctionCompiler.html">   24</a></span>&#160;<span class="keyword">struct </span><a class="code" href="structchi_1_1FunctionCompiler.html">FunctionCompiler</a> {</div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;    <a class="code" href="structchi_1_1FunctionCompiler.html#a5fb0dc53b0e43d00ccc943755a660e99">FunctionCompiler</a>(<span class="keyword">const</span> <a class="code" href="structchi_1_1GraphFunction.html">GraphFunction</a>&amp; func, llvm::Module&amp; moduleToGenInto,</div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;                     llvm::DICompileUnit&amp; debugCU, llvm::DIBuilder&amp; debugBuilder);</div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;    <a class="code" href="structchi_1_1Result.html">Result</a> <a class="code" href="structchi_1_1FunctionCompiler.html#a344523ec8a120e2001436268bd47de52">initialize</a>(<span class="keywordtype">bool</span> validate = <span class="keyword">true</span>);</div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;</div><div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;    <a class="code" href="structchi_1_1Result.html">Result</a> <a class="code" href="structchi_1_1FunctionCompiler.html#ad5d91d8dbaa379a0b90107f37427dec8">compile</a>();</div><div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;</div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;    <span class="keyword">using</span> DebugFunctionType =</div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;<span class="preprocessor">#if LLVM_VERSION_LESS_EQUAL(3, 6)</span></div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;        llvm::DICompositeType</div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;<span class="preprocessor">#else</span></div><div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;        llvm::DISubroutineType*</div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;        ;</div><div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;</div><div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;    DebugFunctionType <a class="code" href="structchi_1_1FunctionCompiler.html#affeb034e0b6a66320398482eda2f3945">createSubroutineType</a>();</div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;</div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;    <span class="keyword">using</span> DebugFunction = llvm::DISubprogram</div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;<span class="preprocessor">#if LLVM_VERSION_AT_LEAST(3, 7)</span></div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;        *</div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;        ;</div><div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;    <span class="keyword">using</span> DebugFile = llvm::DIFile</div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;<span class="preprocessor">#if LLVM_VERSION_AT_LEAST(3, 7)</span></div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;        *</div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;        ;</div><div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;</div><div class="line"><a name="l00073"></a><span class="lineno"><a class="line" href="structchi_1_1FunctionCompiler.html#aa97c31db4535d8921a0e0ac4d5397de1">   73</a></span>&#160;    DebugFunction <a class="code" href="structchi_1_1FunctionCompiler.html#aa97c31db4535d8921a0e0ac4d5397de1">diFunction</a>() {</div><div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;        assert(<a class="code" href="structchi_1_1FunctionCompiler.html#ac465b7c74ea65a5ca5f5ef748aca9258">initialized</a>() &amp;&amp;</div><div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;               <span class="stringliteral">&quot;Please initialize the function compiler before getting the debug function&quot;</span>);</div><div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;        <span class="keywordflow">return</span> mDebugFunc;</div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;    }</div><div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;</div><div class="line"><a name="l00081"></a><span class="lineno"><a class="line" href="structchi_1_1FunctionCompiler.html#a3bc147aa1b93c8e8c08c91ade3e13024">   81</a></span>&#160;    llvm::Module&amp; <a class="code" href="structchi_1_1FunctionCompiler.html#a3bc147aa1b93c8e8c08c91ade3e13024">llvmModule</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> *mModule; }</div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;</div><div class="line"><a name="l00085"></a><span class="lineno"><a class="line" href="structchi_1_1FunctionCompiler.html#afa233d01c21e6204e0bb1a11947198dd">   85</a></span>&#160;    llvm::DIBuilder&amp; <a class="code" href="structchi_1_1FunctionCompiler.html#afa233d01c21e6204e0bb1a11947198dd">diBuilder</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> *mDIBuilder; }</div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;</div><div class="line"><a name="l00089"></a><span class="lineno"><a class="line" href="structchi_1_1FunctionCompiler.html#a801b216f9d3db39c51d976b61fdbe7af">   89</a></span>&#160;    llvm::DICompileUnit* <a class="code" href="structchi_1_1FunctionCompiler.html#a801b216f9d3db39c51d976b61fdbe7af">debugCompileUnit</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> mDebugCU; }</div><div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;</div><div class="line"><a name="l00094"></a><span class="lineno"><a class="line" href="structchi_1_1FunctionCompiler.html#a6b947fd013eb2062a5ac74d771182d95">   94</a></span>&#160;    llvm::BasicBlock&amp; <a class="code" href="structchi_1_1FunctionCompiler.html#a6b947fd013eb2062a5ac74d771182d95">allocBlock</a>()<span class="keyword"> const </span>{</div><div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;        assert(<a class="code" href="structchi_1_1FunctionCompiler.html#ac465b7c74ea65a5ca5f5ef748aca9258">initialized</a>() &amp;&amp;</div><div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;               <span class="stringliteral">&quot;Please initialize the function compiler before getting the alloc block&quot;</span>);</div><div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;        <span class="keywordflow">return</span> *mAllocBlock;</div><div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;    }</div><div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;</div><div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;    llvm::Value* <a class="code" href="structchi_1_1FunctionCompiler.html#a7e93c63cf4a5ad9f9073c69bbe07fc9a">localVariable</a>(boost::string_view name);</div><div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;</div><div class="line"><a name="l00108"></a><span class="lineno"><a class="line" href="structchi_1_1FunctionCompiler.html#abe3c5a09c2b6f5f53c847c8331006f23">  108</a></span>&#160;    llvm::Function&amp; <a class="code" href="structchi_1_1FunctionCompiler.html#abe3c5a09c2b6f5f53c847c8331006f23">llFunction</a>()<span class="keyword"> const </span>{</div><div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;        assert(<a class="code" href="structchi_1_1FunctionCompiler.html#ac465b7c74ea65a5ca5f5ef748aca9258">initialized</a>() &amp;&amp;</div><div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;               <span class="stringliteral">&quot;Please initialize the function compiler before trying to get the LLVM function&quot;</span>);</div><div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;        <span class="keywordflow">return</span> *mLLFunction;</div><div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;    }</div><div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;</div><div class="line"><a name="l00117"></a><span class="lineno"><a class="line" href="structchi_1_1FunctionCompiler.html#a6bbb1077fc678b9d2aebc1a42495dfb9">  117</a></span>&#160;    llvm::Value&amp; <a class="code" href="structchi_1_1FunctionCompiler.html#a6bbb1077fc678b9d2aebc1a42495dfb9">postPureBreak</a>()<span class="keyword"> const </span>{</div><div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;        assert(<a class="code" href="structchi_1_1FunctionCompiler.html#ac465b7c74ea65a5ca5f5ef748aca9258">initialized</a>() &amp;&amp;</div><div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;               <span class="stringliteral">&quot;Please initialize the function compiler before trying to get the post-pure break&quot;</span>);</div><div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;        <span class="keywordflow">return</span> *mPostPureBreak;</div><div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;    }</div><div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;</div><div class="line"><a name="l00125"></a><span class="lineno"><a class="line" href="structchi_1_1FunctionCompiler.html#a7c93960313bdbd91fb703b7095a51e94">  125</a></span>&#160;    <span class="keyword">const</span> <a class="code" href="structchi_1_1GraphFunction.html">GraphFunction</a>&amp; <span class="keyword">function</span>() <span class="keyword">const</span> { <span class="keywordflow">return</span> *mFunction; }</div><div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;</div><div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;    <a class="code" href="structchi_1_1GraphModule.html">GraphModule</a>&amp; <a class="code" href="structchi_1_1FunctionCompiler.html#a5be5f3d00d513273a40082140b514922">module</a>() <span class="keyword">const</span>;</div><div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;</div><div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;    <a class="code" href="structchi_1_1Context.html">Context</a>&amp; <a class="code" href="structchi_1_1FunctionCompiler.html#a320ffa20b43bd6115fee6408ee9d3ba1">context</a>() <span class="keyword">const</span>;</div><div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;</div><div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;    <span class="keywordtype">int</span> <a class="code" href="structchi_1_1FunctionCompiler.html#ad3a3ebb8527c7d061f3a33075b7a2d18">nodeLineNumber</a>(<a class="code" href="structchi_1_1NodeInstance.html">NodeInstance</a>&amp; node);</div><div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;</div><div class="line"><a name="l00144"></a><span class="lineno"><a class="line" href="structchi_1_1FunctionCompiler.html#ac465b7c74ea65a5ca5f5ef748aca9258">  144</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="structchi_1_1FunctionCompiler.html#ac465b7c74ea65a5ca5f5ef748aca9258">initialized</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> mInitialized; }</div><div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;</div><div class="line"><a name="l00148"></a><span class="lineno"><a class="line" href="structchi_1_1FunctionCompiler.html#afae7957136615c414090dd9930e05c54">  148</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="structchi_1_1FunctionCompiler.html#afae7957136615c414090dd9930e05c54">compiled</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> mCompiled; }</div><div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;</div><div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;    <a class="code" href="structchi_1_1NodeCompiler.html">NodeCompiler</a>* <a class="code" href="structchi_1_1FunctionCompiler.html#a85f29ea79e8fab1c963f096be468a1a5">nodeCompiler</a>(<a class="code" href="structchi_1_1NodeInstance.html">NodeInstance</a>&amp; node);</div><div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;</div><div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;    <a class="code" href="structchi_1_1NodeCompiler.html">NodeCompiler</a>* <a class="code" href="structchi_1_1FunctionCompiler.html#a83ceb200ef91138e1df8c08a05b51dc1">getOrCreateNodeCompiler</a>(<a class="code" href="structchi_1_1NodeInstance.html">NodeInstance</a>&amp; node);</div><div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;</div><div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;<span class="keyword">private</span>:</div><div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;    std::unordered_map&lt;std::string, llvm::Value*&gt; mLocalVariables;</div><div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;</div><div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;    llvm::Module*        mModule    = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;    llvm::DIBuilder*     mDIBuilder = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;    llvm::DICompileUnit* mDebugCU   = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;    DebugFile            mDIFile{};</div><div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;    DebugFunction        mDebugFunc{};</div><div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;</div><div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;    <span class="keyword">const</span> <a class="code" href="structchi_1_1GraphFunction.html">GraphFunction</a>* mFunction = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;</div><div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;    llvm::Function*   mLLFunction = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;    llvm::BasicBlock* mAllocBlock = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;</div><div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;    std::unordered_map&lt;NodeInstance*, NodeCompiler&gt; mNodeCompilers;</div><div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;</div><div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;    boost::bimap&lt;unsigned, NodeInstance*&gt; mNodeLocations;</div><div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;</div><div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;    <span class="keywordtype">bool</span> mInitialized = <span class="keyword">false</span>;</div><div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;    <span class="keywordtype">bool</span> mCompiled    = <span class="keyword">false</span>;</div><div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;</div><div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;    llvm::Value* mPostPureBreak = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;};</div><div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;</div><div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;<a class="code" href="structchi_1_1Result.html">Result</a> <a class="code" href="namespacechi.html#a8329038fce8125396cc9775460aa427b">compileFunction</a>(<span class="keyword">const</span> <a class="code" href="structchi_1_1GraphFunction.html">GraphFunction</a>&amp; func, llvm::Module* mod, llvm::DICompileUnit* debugCU,</div><div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;                       llvm::DIBuilder&amp; debugBuilder);</div><div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;}  <span class="comment">// namespace chi</span></div><div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;</div><div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;<span class="preprocessor">#endif  // CHI_FUNCTION_COMPILER_HPP</span></div><div class="ttc" id="LLVMVersion_8hpp_html"><div class="ttname"><a href="LLVMVersion_8hpp.html">LLVMVersion.hpp</a></div></div>
<div class="ttc" id="structchi_1_1GraphFunction_html"><div class="ttname"><a href="structchi_1_1GraphFunction.html">chi::GraphFunction</a></div><div class="ttdoc">this is an AST-like representation of a function in a graph It is used for IDE-like behavior...</div><div class="ttdef"><b>Definition:</b> <a href="GraphFunction_8hpp_source.html#l00023">GraphFunction.hpp:23</a></div></div>
<div class="ttc" id="structchi_1_1FunctionCompiler_html_a85f29ea79e8fab1c963f096be468a1a5"><div class="ttname"><a href="structchi_1_1FunctionCompiler.html#a85f29ea79e8fab1c963f096be468a1a5">chi::FunctionCompiler::nodeCompiler</a></div><div class="ttdeci">NodeCompiler * nodeCompiler(NodeInstance &amp;node)</div><div class="ttdoc">Get a node compile for a certain node. </div><div class="ttdef"><b>Definition:</b> <a href="FunctionCompiler_8cpp_source.html#l00353">FunctionCompiler.cpp:353</a></div></div>
<div class="ttc" id="core_2include_2chi_2Fwd_8hpp_html"><div class="ttname"><a href="core_2include_2chi_2Fwd_8hpp.html">Fwd.hpp</a></div><div class="ttdoc">Forward declares all the chigraph data types. </div></div>
<div class="ttc" id="structchi_1_1FunctionCompiler_html_a3bc147aa1b93c8e8c08c91ade3e13024"><div class="ttname"><a href="structchi_1_1FunctionCompiler.html#a3bc147aa1b93c8e8c08c91ade3e13024">chi::FunctionCompiler::llvmModule</a></div><div class="ttdeci">llvm::Module &amp; llvmModule() const</div><div class="ttdoc">Get the module being generated. </div><div class="ttdef"><b>Definition:</b> <a href="FunctionCompiler_8hpp_source.html#l00081">FunctionCompiler.hpp:81</a></div></div>
<div class="ttc" id="structchi_1_1FunctionCompiler_html_aa97c31db4535d8921a0e0ac4d5397de1"><div class="ttname"><a href="structchi_1_1FunctionCompiler.html#aa97c31db4535d8921a0e0ac4d5397de1">chi::FunctionCompiler::diFunction</a></div><div class="ttdeci">DebugFunction diFunction()</div><div class="ttdoc">Get the debug function. </div><div class="ttdef"><b>Definition:</b> <a href="FunctionCompiler_8hpp_source.html#l00073">FunctionCompiler.hpp:73</a></div></div>
<div class="ttc" id="structchi_1_1NodeInstance_html"><div class="ttname"><a href="structchi_1_1NodeInstance.html">chi::NodeInstance</a></div><div class="ttdoc">An instance of a node. </div><div class="ttdef"><b>Definition:</b> <a href="NodeInstance_8hpp_source.html#l00019">NodeInstance.hpp:19</a></div></div>
<div class="ttc" id="structchi_1_1NodeCompiler_html"><div class="ttname"><a href="structchi_1_1NodeCompiler.html">chi::NodeCompiler</a></div><div class="ttdoc">Helper to compile nodes. </div><div class="ttdef"><b>Definition:</b> <a href="NodeCompiler_8hpp_source.html#l00024">NodeCompiler.hpp:24</a></div></div>
<div class="ttc" id="structchi_1_1FunctionCompiler_html_ad5d91d8dbaa379a0b90107f37427dec8"><div class="ttname"><a href="structchi_1_1FunctionCompiler.html#ad5d91d8dbaa379a0b90107f37427dec8">chi::FunctionCompiler::compile</a></div><div class="ttdeci">Result compile()</div><div class="ttdoc">Generates the contents of the function. </div><div class="ttdef"><b>Definition:</b> <a href="FunctionCompiler_8cpp_source.html#l00198">FunctionCompiler.cpp:198</a></div></div>
<div class="ttc" id="structchi_1_1FunctionCompiler_html_a801b216f9d3db39c51d976b61fdbe7af"><div class="ttname"><a href="structchi_1_1FunctionCompiler.html#a801b216f9d3db39c51d976b61fdbe7af">chi::FunctionCompiler::debugCompileUnit</a></div><div class="ttdeci">llvm::DICompileUnit * debugCompileUnit() const</div><div class="ttdoc">The compile unit for the module. </div><div class="ttdef"><b>Definition:</b> <a href="FunctionCompiler_8hpp_source.html#l00089">FunctionCompiler.hpp:89</a></div></div>
<div class="ttc" id="structchi_1_1Context_html"><div class="ttname"><a href="structchi_1_1Context.html">chi::Context</a></div><div class="ttdoc">The class that handles the loading, creation, storing, and compilation of modules It also stores a LL...</div><div class="ttdef"><b>Definition:</b> <a href="Context_8hpp_source.html#l00055">Context.hpp:55</a></div></div>
<div class="ttc" id="structchi_1_1FunctionCompiler_html"><div class="ttname"><a href="structchi_1_1FunctionCompiler.html">chi::FunctionCompiler</a></div><div class="ttdoc">Class for compiling GraphFunctions into llvm::Functions. </div><div class="ttdef"><b>Definition:</b> <a href="FunctionCompiler_8hpp_source.html#l00024">FunctionCompiler.hpp:24</a></div></div>
<div class="ttc" id="structchi_1_1FunctionCompiler_html_a6bbb1077fc678b9d2aebc1a42495dfb9"><div class="ttname"><a href="structchi_1_1FunctionCompiler.html#a6bbb1077fc678b9d2aebc1a42495dfb9">chi::FunctionCompiler::postPureBreak</a></div><div class="ttdeci">llvm::Value &amp; postPureBreak() const</div><div class="ttdoc">Get the value for the address to jump back to. </div><div class="ttdef"><b>Definition:</b> <a href="FunctionCompiler_8hpp_source.html#l00117">FunctionCompiler.hpp:117</a></div></div>
<div class="ttc" id="structchi_1_1FunctionCompiler_html_ad3a3ebb8527c7d061f3a33075b7a2d18"><div class="ttname"><a href="structchi_1_1FunctionCompiler.html#ad3a3ebb8527c7d061f3a33075b7a2d18">chi::FunctionCompiler::nodeLineNumber</a></div><div class="ttdeci">int nodeLineNumber(NodeInstance &amp;node)</div><div class="ttdoc">Get the debug line number for the node instance Unique for each node. </div><div class="ttdef"><b>Definition:</b> <a href="FunctionCompiler_8cpp_source.html#l00342">FunctionCompiler.cpp:342</a></div></div>
<div class="ttc" id="structchi_1_1FunctionCompiler_html_a6b947fd013eb2062a5ac74d771182d95"><div class="ttname"><a href="structchi_1_1FunctionCompiler.html#a6b947fd013eb2062a5ac74d771182d95">chi::FunctionCompiler::allocBlock</a></div><div class="ttdeci">llvm::BasicBlock &amp; allocBlock() const</div><div class="ttdoc">The block for allocating variables at the beginning of the function. </div><div class="ttdef"><b>Definition:</b> <a href="FunctionCompiler_8hpp_source.html#l00094">FunctionCompiler.hpp:94</a></div></div>
<div class="ttc" id="structchi_1_1FunctionCompiler_html_a83ceb200ef91138e1df8c08a05b51dc1"><div class="ttname"><a href="structchi_1_1FunctionCompiler.html#a83ceb200ef91138e1df8c08a05b51dc1">chi::FunctionCompiler::getOrCreateNodeCompiler</a></div><div class="ttdeci">NodeCompiler * getOrCreateNodeCompiler(NodeInstance &amp;node)</div><div class="ttdoc">Get or create a node compiler for a node. </div><div class="ttdef"><b>Definition:</b> <a href="FunctionCompiler_8cpp_source.html#l00362">FunctionCompiler.cpp:362</a></div></div>
<div class="ttc" id="structchi_1_1FunctionCompiler_html_afae7957136615c414090dd9930e05c54"><div class="ttname"><a href="structchi_1_1FunctionCompiler.html#afae7957136615c414090dd9930e05c54">chi::FunctionCompiler::compiled</a></div><div class="ttdeci">bool compiled() const</div><div class="ttdoc">Get if the function has been compiled (compile() has been called) </div><div class="ttdef"><b>Definition:</b> <a href="FunctionCompiler_8hpp_source.html#l00148">FunctionCompiler.hpp:148</a></div></div>
<div class="ttc" id="structchi_1_1FunctionCompiler_html_a5fb0dc53b0e43d00ccc943755a660e99"><div class="ttname"><a href="structchi_1_1FunctionCompiler.html#a5fb0dc53b0e43d00ccc943755a660e99">chi::FunctionCompiler::FunctionCompiler</a></div><div class="ttdeci">FunctionCompiler(const GraphFunction &amp;func, llvm::Module &amp;moduleToGenInto, llvm::DICompileUnit &amp;debugCU, llvm::DIBuilder &amp;debugBuilder)</div><div class="ttdoc">Constructor. </div><div class="ttdef"><b>Definition:</b> <a href="FunctionCompiler_8cpp_source.html#l00031">FunctionCompiler.cpp:31</a></div></div>
<div class="ttc" id="namespacechi_html_a8329038fce8125396cc9775460aa427b"><div class="ttname"><a href="namespacechi.html#a8329038fce8125396cc9775460aa427b">chi::compileFunction</a></div><div class="ttdeci">Result compileFunction(const GraphFunction &amp;func, llvm::Module *mod, llvm::DICompileUnit *debugCU, llvm::DIBuilder &amp;debugBuilder)</div><div class="ttdoc">Compile the graph to an llvm::Function (usually called from JsonModule::generateModule) ...</div><div class="ttdef"><b>Definition:</b> <a href="FunctionCompiler_8cpp_source.html#l00371">FunctionCompiler.cpp:371</a></div></div>
<div class="ttc" id="structchi_1_1FunctionCompiler_html_a7e93c63cf4a5ad9f9073c69bbe07fc9a"><div class="ttname"><a href="structchi_1_1FunctionCompiler.html#a7e93c63cf4a5ad9f9073c69bbe07fc9a">chi::FunctionCompiler::localVariable</a></div><div class="ttdeci">llvm::Value * localVariable(boost::string_view name)</div><div class="ttdoc">Get the value for a local variable. </div><div class="ttdef"><b>Definition:</b> <a href="FunctionCompiler_8cpp_source.html#l00330">FunctionCompiler.cpp:330</a></div></div>
<div class="ttc" id="structchi_1_1FunctionCompiler_html_a320ffa20b43bd6115fee6408ee9d3ba1"><div class="ttname"><a href="structchi_1_1FunctionCompiler.html#a320ffa20b43bd6115fee6408ee9d3ba1">chi::FunctionCompiler::context</a></div><div class="ttdeci">Context &amp; context() const</div><div class="ttdoc">Get function().context() </div><div class="ttdef"><b>Definition:</b> <a href="FunctionCompiler_8cpp_source.html#l00340">FunctionCompiler.cpp:340</a></div></div>
<div class="ttc" id="structchi_1_1FunctionCompiler_html_afa233d01c21e6204e0bb1a11947198dd"><div class="ttname"><a href="structchi_1_1FunctionCompiler.html#afa233d01c21e6204e0bb1a11947198dd">chi::FunctionCompiler::diBuilder</a></div><div class="ttdeci">llvm::DIBuilder &amp; diBuilder() const</div><div class="ttdoc">The debug builder we&amp;#39;re using for the module. </div><div class="ttdef"><b>Definition:</b> <a href="FunctionCompiler_8hpp_source.html#l00085">FunctionCompiler.hpp:85</a></div></div>
<div class="ttc" id="structchi_1_1GraphModule_html"><div class="ttname"><a href="structchi_1_1GraphModule.html">chi::GraphModule</a></div><div class="ttdoc">Module that holds graph functions. </div><div class="ttdef"><b>Definition:</b> <a href="GraphModule_8hpp_source.html#l00016">GraphModule.hpp:16</a></div></div>
<div class="ttc" id="structchi_1_1FunctionCompiler_html_abe3c5a09c2b6f5f53c847c8331006f23"><div class="ttname"><a href="structchi_1_1FunctionCompiler.html#abe3c5a09c2b6f5f53c847c8331006f23">chi::FunctionCompiler::llFunction</a></div><div class="ttdeci">llvm::Function &amp; llFunction() const</div><div class="ttdoc">Get the llvm function this compiler is generating. </div><div class="ttdef"><b>Definition:</b> <a href="FunctionCompiler_8hpp_source.html#l00108">FunctionCompiler.hpp:108</a></div></div>
<div class="ttc" id="namespacechi_html"><div class="ttname"><a href="namespacechi.html">chi</a></div><div class="ttdoc">The namespace where chigraph lives. </div><div class="ttdef"><b>Definition:</b> <a href="BitcodeParser_8hpp_source.html#l00012">BitcodeParser.hpp:12</a></div></div>
<div class="ttc" id="structchi_1_1FunctionCompiler_html_a344523ec8a120e2001436268bd47de52"><div class="ttname"><a href="structchi_1_1FunctionCompiler.html#a344523ec8a120e2001436268bd47de52">chi::FunctionCompiler::initialize</a></div><div class="ttdeci">Result initialize(bool validate=true)</div><div class="ttdoc">Creates the function, but don&amp;#39;t actually generate into it. </div><div class="ttdef"><b>Definition:</b> <a href="FunctionCompiler_8cpp_source.html#l00035">FunctionCompiler.cpp:35</a></div></div>
<div class="ttc" id="structchi_1_1FunctionCompiler_html_ac465b7c74ea65a5ca5f5ef748aca9258"><div class="ttname"><a href="structchi_1_1FunctionCompiler.html#ac465b7c74ea65a5ca5f5ef748aca9258">chi::FunctionCompiler::initialized</a></div><div class="ttdeci">bool initialized() const</div><div class="ttdoc">Get if the function is initialized (initialize() has been called) </div><div class="ttdef"><b>Definition:</b> <a href="FunctionCompiler_8hpp_source.html#l00144">FunctionCompiler.hpp:144</a></div></div>
<div class="ttc" id="structchi_1_1Result_html"><div class="ttname"><a href="structchi_1_1Result.html">chi::Result</a></div><div class="ttdoc">The result object, used for identifiying errors with good diagnostics. </div><div class="ttdef"><b>Definition:</b> <a href="Result_8hpp_source.html#l00072">Result.hpp:72</a></div></div>
<div class="ttc" id="NodeCompiler_8hpp_html"><div class="ttname"><a href="NodeCompiler_8hpp.html">NodeCompiler.hpp</a></div></div>
<div class="ttc" id="structchi_1_1FunctionCompiler_html_a5be5f3d00d513273a40082140b514922"><div class="ttname"><a href="structchi_1_1FunctionCompiler.html#a5be5f3d00d513273a40082140b514922">chi::FunctionCompiler::module</a></div><div class="ttdeci">GraphModule &amp; module() const</div><div class="ttdoc">Get function().module() </div><div class="ttdef"><b>Definition:</b> <a href="FunctionCompiler_8cpp_source.html#l00339">FunctionCompiler.cpp:339</a></div></div>
<div class="ttc" id="structchi_1_1FunctionCompiler_html_affeb034e0b6a66320398482eda2f3945"><div class="ttname"><a href="structchi_1_1FunctionCompiler.html#affeb034e0b6a66320398482eda2f3945">chi::FunctionCompiler::createSubroutineType</a></div><div class="ttdeci">DebugFunctionType createSubroutineType()</div><div class="ttdoc">Create the subroutine type for the function. </div><div class="ttdef"><b>Definition:</b> <a href="FunctionCompiler_8cpp_source.html#l00275">FunctionCompiler.cpp:275</a></div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_97aefd0d527b934f1d99a682da8fe6a9.html">lib</a></li><li class="navelem"><a class="el" href="dir_a2d5e495f4b604d04f57d90095a59dd6.html">core</a></li><li class="navelem"><a class="el" href="dir_a979adfa99d5a8626731f83d5067598b.html">include</a></li><li class="navelem"><a class="el" href="dir_afbc2aa4d9616322ddf4041ba4f8ade6.html">chi</a></li><li class="navelem"><a class="el" href="FunctionCompiler_8hpp.html">FunctionCompiler.hpp</a></li>
    <li class="footer">Generated on Sat Sep 16 2017 17:41:35 for chigraph by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
  </ul>
</div>
</body>
</html>
